<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
	<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
	<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
	<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
    
    
    <title>进货管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
		function changetoquery()
		{
			document.form1.action="servlet/Stockwithgoodsservlet?type=query";
			document.form1.submit();
		}
		
		function checknumber()
		{
			return true;
		}
		function changetostock()
		{
			if(checknumber())
			{
			document.form1.action="servlet/Stockwithgoodsservlet?type=stock";
			document.form1.submit();
			}
			else
			{
				alert("超过可用库存量");
			}
		}
	</script>

  </head>
  
  <body>
    <form name="form1" id="form1" method="post">
    <div id="container">	
		<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_border">
						<div id="box_top">查询</div>
						<div id="box_center" >
							商品名称<input class="ui_input_txt02" name="product_name" id="product_name" type="text"/>
						</div>
						<div id="box_bottom">
							<input class="ui_input_btn01" type="button" value="查询" onclick="changetoquery()">
						</div>
					</div>
				</div>
			</div>		
			<div class="ui_content">
				<div class="ui_tb">
					<table class="table" width="100%" align="center">
						<tr>
							<th>选择项</th>
							<th>商品id</th>
							<th>商品一级分类</th>
							<th>商品二级分类</th>
							<th>商品名称</th>
							<th>现有库存量</th>
							<th>安全库存量</th>
							<th>缺货数量</th>
							<th>进货量</th>
							<th>计量单位</th>
							<th>日期</th>
						</tr>
						<c:forEach items="${products}" var="temp">
						<tr>
							<td><input name="goods" value="${temp.product_id}" type="checkbox"/></td>
							<td>${temp.product_id }</td>
							<td>${temp.category_lv1 }</td>
							<td>${temp.category_lv2 }</td>
							<td>${temp.product_name }</td>
							<td>${temp.nownumber }</td>
							<td>${temp.warning_number }</td>
							<td>${temp.lessnumber }</td>
							<td><input class="ui_input_txt02" name="${temp.product_id}" type="text" /></td>
							<td>${temp.unit }</td>
							<td>${datestr }</td>				
						</tr>
						</c:forEach>
						<tr><td colspan="11" align="center"><input class="ui_input_btn01" type="button" value="进货" onclick="changetostock()"/></td></tr>
					</table>    
				</div>
			</div>
		</div>
    </form>
  </body>
</html>
